package test;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class testStream {
    public static void main(String[] args) throws IOException {
        FileOutputStream fileOutputStream =
                new FileOutputStream("d:/test.txt");
       String s="hello Java";
       fileOutputStream.write(s.getBytes());
       fileOutputStream.close();
        FileInputStream fileInputStream =
                new FileInputStream("d:/test.txt");
        while (true){
        fileInputStream.read();
        int c =fileInputStream.read();
        if(c==-1) {
            break;
        }
            System.out.println((byte)c);
        }
        fileInputStream.close();
    }
}
